package ModelLayer;
import java.util.*;
public class OrderList
{
    public HashMap<Integer,Order> orderlist;
    private static OrderList instance=null;

    public OrderList()
    {orderlist=new HashMap<Integer,Order>();}

    public static OrderList getInstance() { 
        if(instance == null) 
            instance = new OrderList(); 
        return instance; 
    }

    public void addOrder(Order order) {
        orderlist.put((Integer)order.getId(), order);
    }

    public void deleteOrder(int id) {
        if(orderlist.containsKey(id)) {
            orderlist.remove(id);
        }
    }

    public Order getOrder(int id) {
        if(orderlist.containsKey(id)) {
            return orderlist.get(id);
        }
        return null;
    }

}
